﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IPageable<DR.WebUI.Models.Developer.ReportModel>>" %>

<%@ Import Namespace="DR.WebUI.Models.Developer" %>
<%@ Import Namespace="DR.WebUI.Models.Enums" %>
<%@ Import Namespace="DR.WebUI.Models.Common" %>


<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Developers Reports
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server" style=" min-width:1000">

    <h3>My Reports</h3>
    <div >
        <form method="post" action="SetupReportFilter">
            <div>

            <div style="border-right: 1px solid #e2e2e2; float: left; margin-right: 10px; margin-top: 5px;">
                <a href="/Developer/AddNewReport" class="linkAddReport">Add Report</a>
            </div>

            <table>
                <tr>
                    <td><b>Reporting Period</b></td>
                    <td><b>Project</b></td>
                    <td><b>State</b></td>
                    <td rowspan="2" style="vertical-align:bottom">
                        <input type="submit" name="filterButton" value="Apply" id="Apply"/>
                        <input type="submit" name="filterButton" value="Reset" id="Reset"/>
                    </td>
                </tr>
                <tr>
                    <% ReportFilter filter = (ReportFilter)ViewData["ReportFilter"]; %>
                    <td>                    
                        <%: Html.DropDownList("reportingPeriodID", (IList<SelectListItem>)ViewData["ReportingPeriods"])%>
                    </td>
                    <td>
                        <%: Html.DropDownList("projectID", (IList<SelectListItem>)ViewData["Projects"])%>
                    </td>
                    <td>
                        <% foreach (EnumItem item in (IList<EnumItem>)ViewData["ReportStatuses"]) %>
                        <% { %>
                            <input type="checkbox" name="statuses" value="<%: item.StatusID %>" <%: filter.SelectedReportStatuses.Contains(item.StatusID) ? "checked='checked'" : "" %> />
                            <%: item.Text %>
                        <% } %>
                    </td>
                </tr>   
            </table> 
        </div>
        </form>
        </div>

    
        
    <br />
    <div id="tableStyle">
        <table >
            <thead>
                <tr>
                    <th style="width:8%; min-width:70px;">Report ID</th>
                    <th>Title</th>
                    <th>Project</th>
                    <th style="width:40px">Hours</th>
                    <th style="width:8%; min-width:100px">Date Reporting</th>
                    <th style="width:8%; min-width:140px">Created</th>
                    <th style="width:8%; min-width:140px">Modified</th>
                    <th style="width:8%">State</th>
                     <% 
                        int width = 30;
                        if((bool)ViewData["ShownDeleteButton"])
                        {
                       
                            width += 30;
                        }
                         if((bool)ViewData["ShownEditButton"])
                        {
                        

                            width += 30;
                        }
                    %>
                    <th style="width:<%: width %>px; min-width:<%: width %>px; max-width:90px;">
                    </th>
                </tr>
            </thead>
           <%if (Model.Page.Count() == 0) %>
           <%{%>
           <tbody>
                    <tr>
                        <td colspan="8" class="nodata">No Data</td>
                    </tr>
           </tbody>
           <%}%>
           <%else %>
           <%{%>
            <tbody>            
                <%
                 foreach (var r in Model.Page)%>
                <%{%>
                        <tr>
                            <td><%:r.ReportID%></td>
                            <td style="word-wrap:break-word;max-width:310px;min-width:150px;"><%:r.Title%></td>
                            <td style="word-wrap:break-word;max-width:200px;min-width:150px;"><%:r.Project%></td>
                            <td><%:r.Hours%></td>
                            <td><%:r.DateReporting.Value.ToShortDateString()%></td>
                            <td><%:r.DateCreate%></td>
                            <td><%:r.DateModified%></td>
                            <td><%:r.State%></td>     
                            <td>    
                                    <a href="ViewReportDetails/<%=r.ReportID%>" class="viewTask" title="View Details"></a>
                                    <% if (r.CanDeleteByDeveloper) %>
                                    <% { %>
                                            <div>
                                                <%: Html.Hidden("ReportID_" + r.ReportID, r.ReportID, new {@class = "report-id"}) %>
                                                <div class="delete" title="Delete"></div>
                                            </div>
                                    <% } %>
                                <% if (r.CanEditByDeveloper) %>
                                <% { %>
                                      <%--<a href="EditReport?reportID=<%=r.ReportID %>" class="editTask" title="Edit"/>--%>
                                      <a href="EditReport/<%:r.ReportID %>" class="editTask" title="Edit"/>
                                <% }%>
                            </td>     
                        </tr>        
                <% } %>
            </tbody>
            <% } %>
        </table>
    </div>
    
    <div>
        <%= Html.Pagination() %>
    </div>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="headPlaceHolder" runat="server">    

    <script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-1.4.4.min.js")%>"></script>
    <script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery-ui-1.8.7.custom.min.js")%>"></script>
    <script type="text/javascript" src="<%= Url.Content("~/Scripts/Report/modal-approve-report-by-developer.js")%>"></script>
    <script type="text/javascript" src="<%= Url.Content("~/Scripts/Developer/modal-delete-report-by-developer.js")%>"></script>

    <link type="text/css" href="/Content/jquery/jquery-ui-1.8.7.custom.css" rel="stylesheet" />
    <link type="text/css" href="/Content/css/Awesome.css" rel="stylesheet"  />

    <script type="text/javascript" src="<%= Url.Content("~/Scripts/jquery.form.js")%>" ></script>
    <script type="text/javascript" src="<%= Url.Content("~/Scripts/Awesome.js")%>" ></script>

<%--     <script type="text/javascript" language="javascript">
         $(function () {
             $("#Apply").button();
             $("#Reset").button();
         });
	</script>--%>

</asp:Content>
